<?php


namespace app\common\model;


use think\Model;

class Demo extends Model
{
    public function getDemoDataByCategoryId($categoryId, $limit = 10){
        if(empty($categoryId)){
            return [];
        }
        $results = $this->where("category_id",$categoryId)
            ->limit($limit)
            ->order("id","desc")
            ->select()
            ->toArray();//是对象要转换成数组
        return $results;
    }
}